﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SilverlightClient.SLWcfGeebaService;

namespace SilverlightClient
{
    /// <summary>
    /// Interaction logic for threadControl.xaml
    /// </summary>
    public partial class ThreadControl : UserControl
    {
        private User user;
        private GThread myThread;

        public ThreadControl()
        {
            InitializeComponent();
        }

        public ThreadControl(User user, GThread thread)
        {
            InitializeComponent();
            this.user = user;
            this.tidTxt.Content = thread._id;
            this.threadTxt.Content = (thread._subject != null ? thread._subject : "");
            this.contentTxt.Text = (thread._content != null ? thread._content : "");
            this.publishedByLabel.Content = (thread._publisher != null ? thread._publisher.username : "");
            this.LastModifyLabel.Content = thread._modifiedDate.ToShortDateString() + "\r\n" + thread._modifiedDate.ToShortTimeString();
            this.myThread = thread;
        }

        public GThread getThread()
        {
            return myThread;
        }
    }
}
